<%--
  User: Shengzhao Li
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>登录</title>

</head>
<body>
<%--login page--%>
<div id="login_page" data-role="page" class="page">
    <div data-role="header" data-theme="f">
        <a href="${contextPath}/m/dashboard" data-icon="home" data-direction="reverse"
           data-transition="slide">主页</a>

        <h1>登录</h1>
    </div>
    <div data-role="content">
        <h2 class="center">请先登录并继续 ...</h2>

        <form id="login_form" method="post" action="${contextPath}/login" data-ajax="false"
              onsubmit="$.mobile.showPageLoadingMsg();">
            <div data-role="fieldcontain">
                <label for="username">邮箱:</label>
                <input type="email" name="j_username" id="username" value="${username}" placeholder="邮箱" required/>
            </div>
            <div data-role="fieldcontain">
                <label for="password">密码:</label>
                <input type="password" name="j_password" id="password" value="${password}" placeholder="密码" required/>
            </div>
            <div data-role="fieldcontain">
                <fieldset data-role="controlgroup">
                    <legend>&nbsp;</legend>
                    <input type="checkbox" name="_spring_security_remember_me" id="remember_me" data-mini="true"/>
                    <label for="remember_me">记住我</label>
                </fieldset>
            </div>
            <div data-role="fieldcontain">
                <button type="submit" data-theme="b">登录</button>
            </div>
        </form>
        <div class="red" id="login_error_msg">
            <c:if test="${not empty param.error}">
                <c:choose>
                    <c:when test="${param.error== 1}">
                        登录失败,检查用户名与密码.
                    </c:when>
                    <c:when test="${param.error== 2}">
                        拒绝访问,权限不足.
                    </c:when>
                </c:choose>
            </c:if>
        </div>
    </div>
    <div data-role="footer" data-position="fixed" data-theme="c">
        <div data-role="navbar">
            <ul>
                <li><a href="${contextPath}/m/login/forgot_password" data-icon="forward"
                       data-transition="slide">忘记密码</a></li>
                <li><a href="${contextPath}/m/register" data-icon="plus" data-transition="slide">注册新用户</a></li>
            </ul>
        </div>
    </div>
</div>
</body>
</html>